<script setup>
import { reactive, readonly, shallowReadonly } from 'vue';

const person1 = readonly({
    name:"sunWuKong",
    car:{
        name:"DaZhong"
    }
})

let person2 = reactive({
    name:"tangSeng",
    car:{
        name:"BaoMa"
    }
})

person2 = shallowReadonly(person2)

const changePerson1 = () => {
    person1.car.name = "MaiBaHe"
    console.log(person1)
}
const changePerson2 = () => {
    person2.car.name = "BaoJun"
    console.log(person2)
}
</script>

<template>
    <h2>person1</h2><span>{{person1}}</span>
    <h2>person2</h2><span>{{person2}}</span>
    <button @click="changePerson1">修改person1</button>
    <button @click="changePerson2">修改person2</button>
</template>

